package extreme.fizzbuzz;

public class FizzBuzz {

    public static final String FIZZ = "Fizz";
    public static final String BUZZ = "Buzz";
    public static final String WHIZZ = "Whizz";

    public static void main(String[] args) {
        // 获取随机学生数量
        int studentsCount = (int) (Math.random()*100 + 100);
        for (int i = 1; i <= studentsCount; i++) {
            System.out.println("student " + i + " says " + getSerialNum(i));
        }
    }

    public static String getSerialNum(int student) {
        if (String.valueOf(student).contains("3")) {
            return FIZZ;
        }
        StringBuffer serialNum = new StringBuffer();
        if (student%3 == 0) {
            serialNum.append(FIZZ);
        }
        if (student%5 == 0) {
            serialNum.append(BUZZ);
        }
        if (student%7 == 0) {
            serialNum.append(WHIZZ);
        }
        return serialNum.toString().equals("") ? String.valueOf(student) : serialNum.toString();
    }
}